<% form_tag :action => 'update', :id=>@user do %>
	<%=  error_messages_for :user %>
	
	<p><label for="user_email">Email</label><br/>
	<%=  text_field :user, :email %></p>
<%if current_user.has_role?('admin')%>
	<p><label for="user_instructor_id">Instructor</label><br/>
	<%=  collection_select :user, :instructor_id, Instructor.find_not_deleted(:all, :order=>'nombre ASC'), 'id', 'nombre', :include_blank=>false,:prompt => 'Instructor...' %>
	</p>
	
	<p><label for="user_roles_role_id">Roles</label><br/>
	<select name="user[role_ids][]" multiple="multiple">
		<% roles = Role.find(:all, :order=>'name ASC')%>
		<% for role in roles %>
			<option value="<%=role.id%>"
			<% if @user.roles.include?(role) then%>
				selected><%=h role.name%></option>
			<%else%>
				><%=h role.name%></option>
			<%end%>
		<%end%>
	</select>
	</p>
<%end%>	
	<p><label for="user_password">Password</label><br/>
	<%=  password_field :user, :password %></p>
	
	<p><label for="user_password_confirmation">Confirm Password</label><br/>
	<%=  password_field :user, :password_confirmation %></p>
	
	<p><%=  submit_tag 'Modificar' %></p>
<% end %>